﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace WebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class WebSocketController : ControllerBase
    {
        private readonly WebSocketConnectionManager _webSocketConnectionManager;

        public WebSocketController(WebSocketConnectionManager webSocketConnectionManager)
        {
            _webSocketConnectionManager = webSocketConnectionManager;
        }

        [HttpGet]
        [Route("ConnectionNum")]
        public IActionResult ConnectionNum()
        {
            int onlineUserCount = _webSocketConnectionManager.GetOnlineUserCount();

            return Ok("WebSocket API Connect Num - " + onlineUserCount);
        }
    }
}
